<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%  request.setCharacterEncoding( "GB2312");%>
<%@ page import="model.User"%>
<%@ page import="model.Student"%>
<%@ page import="model.WeiGui"%>
<%@ page import="dao.WeiGuiDao"%>
<%@ page import="java.util.List" %>

<%
	//检查会话中是否有 "sg" 属性
	Object fdyObj = session.getAttribute("sg");
	if (fdyObj == null) {
	    response.sendRedirect("../view/Login.jsp");
	    return;
	}
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>宿管页面</title>
<link href="../css/Utils.css" rel="stylesheet" type="text/css" />
<link href="../css/List.css" rel="stylesheet" type="text/css" />
<!-- 违规功能部分样式 -->
<link href="../css/WeiGuiSG_edit.css" rel="stylesheet" type="text/css" />
<!-- 退出登录专用 -->
   <script type="text/javascript" src="../view/Loginout.js"></script>
</head>
<body>

<!-- 头部 -->
<div class="header" ><br>
<nerong>&nbsp;&nbsp;宿管页面&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;</nerong>
<button onclick="confirmLogout('<%= (String)session.getAttribute("sg") %>','sg')">退出登录</button>

</div><br>

<div class="left" >
<table width="80%" height="80%">
<th>
<nerong>宿管可选择内容</nerong>

</th>
<tr>
<td>
<a href="../View_Msg/msgSg.jsp">&emsp;个人信息</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_SuShe/SuSheSG_List.jsp">&emsp;楼栋学生信息查询</a><br>
</td>
</tr>
<tr>

<td>
<a href="../View_fix/SgFix.jsp">&emsp;公物报修</a><br>

</td>
</tr>

<tr>
<td>
<a href = "WeiGuiSG.jsp">&emsp;宿舍违规信息处理</a><br>
</td>
</tr>


</table>
</div>


<div class="context">
<!-- 这部分是每个大功能的小功能 -->
<%
        String id = request.getParameter("id");
		String time = request.getParameter("time");
		String type = request.getParameter("type");
    	WeiGuiDao dao = new WeiGuiDao();
        WeiGui msg = dao.getmsgBythree(id,time,type);//因为在违规表中，id和time是组合主键
        if (msg != null) {
%>
 <h2>违规情况修改</h2>
		<form action="../UpdateWeiGuiServlet" method="post">
        <input hidden="hidden" type="text" name="oldid" value="<%= msg.getId() %>" > <br>
      	<input hidden="hidden" type="datetime-local" name="oldtime" value="<%= msg.getTime() %>" ><br>
        <input hidden="hidden" type="text" name="oldtype" value="<%= msg.getType() %>" ><br>
        
        id：<input type="text" name="id" value="<%= msg.getId() %>"><br>
      	时间: <input type="datetime-local" name="time" value="<%= msg.getTime() %>"><br>
        类型: <input type="text" name="type" value="<%= msg.getType() %>"><br>
        原因: <input type="text" name="because" value="<%= msg.getBecause() %>"><br>
        地点: <input type="text" name="address" value="<%= msg.getAddress() %>"><br>
       
        <input type="submit" value="提交修改">
    </form>
 <%
        } else {
    System.out.println("错误！！！！！！！！！");
        }
    %>
</div>


</body>
</html>